﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SynapseGaming.LightingSystem.Core;

namespace The_LarX
{
    public class Tree_Simple : Tree
    {
        public Actor TreeActor;

        public Tree_Simple(string TextureName, string leavesStartName, string ModelName,
            Renderer rend, GameScreen gs)
            : base(rend, gs)
        {
            string leaves = leavesStartName.ToLower();

            TreeActor = new Actor(ModelName);

            for (int i = 0; i < TreeActor.SubActors.Count; i++)
            {
                if (TreeActor.SubActors[i].Name.ToLower().StartsWith(leaves))
                {
                    TreeActor.SubActors[i].DoubleSided = true;
                    TreeActor.SubActors[i].TextureName = TextureName;
                    TreeActor.SubActors[i].TransparencyMode = TransparencyMode.Clip;
                }
            }
            Renderer.SubmitActor(TreeActor);
        }

        public override void Update()
        {
            base.Update();

            TreeActor.Update();
        }

        public override void Draw()
        {
            base.Draw();

            TreeActor.Draw();
        }
    }
}
